// pages/detail/detail.js
Page({
  data:{
    books: [
      { id: 0, title: "红楼梦", price: 39.8 ,url:"../../images/honglou.jpg"},
      { id: 1, title: "西游记", price: 42.5, url: "../../images/xiyou.jpg"},
      { id: 2, title: "水浒传", price: 36.7, url: "../../images/shuihu.jpg"},
      { id: 3, title: "三国演义", price: 38.8 ,url: "../../images/sanguo.jpg"}
    ],
    book:null
  },
  onLoad: function (options) {
    console.log(options.id)
    var id = options.id;
    var book = this.data.books[id];
    this.setData({
      book:book
    })
  },
})